package org.jojo.sort;

import java.util.Arrays;

import static org.jojo.sort.HeapSort.swap;

public class BubbleSort {
    public static void bubbleSort(int[] arr) {
        int length = arr.length;
        for(int i =0 ;i<length;i++){
            for(int j = i+1 ;j<length;j++){
                if(arr[i] > arr[j]){
                    swap(arr,i,j);
                }
            }
        }
    }

    public static void main(String[] args) {
        int[] arr = new int[]{4, 10, 3, 5, 1, 2};
        bubbleSort(arr);
        System.out.println(Arrays.toString(arr));
    }
}
